|
|
Christopher James Huff wrote:
>
> You mean for helping the compiler detect something that can be
> vectorized and doing it automatically? It won't pick out the possibility
> in the one-line version?
> Would it get this version?
> DBL value = 0;
> value += sin(EPoint[0]);
> value += sin(EPoint[1]);
> value += sin(EPoint[2]);
> return Sqr(value/3.0);
No, unfortunately the Intel compiler (the only one that I have which does
vectorisation) does not recoginze this. You explicitly have to use a loop.
I have done rewriting vector.h in such a way. But I have no Pentium4 to
test it :(
> I'm not surprised the for loop wasn't used in the existing
> version...SIMD stuff wasn't even a factor, so of course the code wasn't
> designed for it, and compilers probably weren't good enough at
> optimizing to get rid of the for() loop.
Todays g++ 3.1 does a good job in loop-unrolling. But with my modified
loop-using 'vector.h' it does still produce a slightly slower code (OK,
maybe I have also made some mistakes in the converting..)
- Micha
--
http://objects.povworld.org - the POV-Ray Objects Collection
Post a reply to this message
|
|